package com.mindskip.xzs.domain;


import com.alibaba.excel.annotation.ExcelProperty;
import com.mindskip.xzs.daoru.ExcelImport;
import org.springframework.util.ObjectUtils;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Entity
@Table(name = "t_user")
public class ExcelUser {

    private int rowNum;
    @Id
    private Integer id;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ExcelProperty("用户名")
    @ExcelImport("用户名")
    private String userName;

    @ExcelProperty("真实姓名")
    @ExcelImport("真实姓名")
    private String realName;

    @ExcelProperty("年龄")
    @ExcelImport("年龄")
    private Integer age;


    @ExcelProperty("性别")
    @ExcelImport(value = "性别" ,kv = "1-男;2-女")
    private String sex;

    @ExcelProperty("创建时间")
    @ExcelImport("创建时间")
    private Date birthDay;

    @ExcelProperty("年级")
    @ExcelImport(value = "年级" ,kv = "1-大一;2-大二;3-大三;4-大四")
    private String userLevel;
    @ExcelProperty("电话号码")
    @ExcelImport("电话号码")
    private String phone;

    @ExcelProperty("身份")
    @ExcelImport(value = "身份",kv = "1-学生;2-老师;3-管理员")
    private String role;

    public String getRole(){
        if (this.role.equals("1")){
            return "学生";
        } else if (this.role.equals("2")) {
            return "教师";
        } else if (this.role.equals("3")){
            return "管理员";
        }
        return "";
    }



    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        if (ObjectUtils.isEmpty(this.sex)) {
            return "";
        }

        // 根据实际情况返回 "男" 或 "女"
        if (this.sex.equals("1")) {
            return "男";
        } else if (this.sex.equals("2")) {
            return "女";
        } else {
            return "";
        }
    }
    

    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }

    public String getUserLevel() {
        if (ObjectUtils.isEmpty(this.userLevel)){
            return "";
        }
        if (this.userLevel.equals("1")){
            return "大一";
        } else if (this.userLevel.equals("2")) {
            return "大二";
        }else if (this.userLevel.equals("3")) {
            return "大三";
        }else if (this.userLevel.equals("4")) {
            return "大四";
        }else {
            return "";
        }
    }

    public void setUserLevel(String userLevel) {
        this.userLevel = userLevel;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
